<?php

/**
 * sfGuardUserSUAP form.
 *
 * @package    suap
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrinePluginFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 * 
 * Es el que se utiliza en todo el proyecto. Tiene un set limitado de datos
 * ya que el nombre y apellido y esas cosas se toman de la persona relacionada
 * si estuviera. 
 */
class sfGuardUserSUAPForm extends sfGuardUserForm
{
  public function configure()
  {
        unset($this['first_name'],$this['last_name'], $this['algorithm']);
        unset($this['salt'],$this['is_super_admin'], $this['last_login']);
        unset($this['permissions_list']);
        unset($this['created_at'],$this['updated_at']);
        unset($this['groups_list']);
        unset($this['password']);
        
        
        
        if (sfContext::getInstance()->getUser()->getId() == $this->getObject()->getId()){
            
            $attr['type'] = 'password';
            $this->widgetSchema['password'] = new sfWidgetFormInputText(array(),$attr);
            $this->validatorSchema['password'] = new sfValidatorString(array('max_length' => 128, 'required' => true));          
            $this->widgetSchema['reingresePassword'] = new sfWidgetFormInputText(array(),$attr);
            $this->validatorSchema['reingresePassword'] = new sfValidatorString(array('max_length' => 128, 'required' => true));          
            $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'reingresePassword'));
            
            $this->validatorSchema['username']->setMessages(array('required' => 'Debe especificar un usuario'));
            $this->validatorSchema['username']->setMessages(array('invalid' => 'Ese nombre ya está en uso'));           

       }

  }
}
class sfGuardGroupSUAPForm extends sfGuardGroupForm
{
  public function configure()
  {
        unset($this['permissions_list']);
        unset($this['created_at'],$this['updated_at']);
        unset($this['users_list']);

  }
}


?>